//
//  EmptyDataView.swift
//  EyeVisionForPatients
//
//  Created by PMC on 2020/3/7.
//  Copyright © 2020 tao Tao. All rights reserved.
//

import UIKit

class EmptyDataView: UIView {
    
    var refreshClosure: (() -> Void)?

    @IBOutlet private weak var imageView: UIImageView!
    
    @IBOutlet private weak var titleLabel: UILabel!
    
    @IBOutlet private weak var refreshLabel: UILabel! {
        didSet {
            refreshLabel.textColor = .mainColor
        }
    }
    
    func configure(with image: UIImage? = UIImage(named: "empty_advisory"), title: String?) {
        imageView.image = image
        titleLabel.text = title
    }
    
    override func awakeFromNib() {
        super.awakeFromNib()
        
        backgroundColor = .background
        let tap = UITapGestureRecognizer(target: self, action: #selector(refreshData))
        addGestureRecognizer(tap)
    }
    
    @objc private func refreshData() {
        refreshClosure?()
    }
}
